#include "Observable.h"
#include "Observer.h"

Observable::Observable() {
  numObservers = 0;
}

void Observable::addObserver(Observer *o) {
  if (numObservers < MAX_OBSERVERS) {
    observers[numObservers++] = o;
  }
}

void Observable::notifyObservers() {
  for (int i = 0; i < numObservers; i++) {
    observers[i]->update(this);
  }
}
